package chai.ning.date;

import java.util.Date;

public class DateTest3 {

	public static void main(String[] args) {
		
		final long day = 1000L * 60 * 60 * 24;
		final long cur = System.currentTimeMillis();

		Date first = new Date( cur - day * 365 * 20);
		Date second = new Date( );
		Date third = new Date();
		
		System.out.println( first );	//Wed Sep 06 11:27:15 CST 2000
		System.out.println( second );	//Tue Sep 01 11:27:15 CST 2020
		System.out.println( third);		//Tue Sep 01 11:27:15 CST 2020
		
		System.out.println( first.before(third) );	//true
		System.out.println( third.before(first) );	//false
		
		System.out.println( first.after( third) );	//false
		System.out.println( third.after( first) );	//true
		
		System.out.println( second.equals(first));	//false
		System.out.println( second.equals(third));	//true
		
		System.out.println( third.compareTo(second));//0
		System.out.println( third.compareTo(first) );//1
	}
	
}
